package doctor

import (
	"github.com/bgmp/config"
	"github.com/bgmp/handler"
	"github.com/bgmp/middleware"
	"github.com/bgmp/model"
	"github.com/gin-gonic/gin"
)

func (b Base) DeletePatients(c *gin.Context, req *DeletePatientsRequest) *DeletePatientsResponse {
	user, err := middleware.GetDoctor(c)
	if err != nil {
		handler.Errorf(c, err.Error())
		return nil
	}
	tr := model.TherapeuticRelationship{
		Doctor:   user.ID,
		Patients: req.Patients,
	}
	err = tr.Delete(config.DB)
	if err != nil {
		handler.Errorf(c, err.Error())
		return nil
	}
	return &DeletePatientsResponse{}
}

type DeletePatientsRequest struct {
	Patients []uint `json:"patients"`
}

type DeletePatientsResponse struct {
}
